var profit = {
	init:function(){
        this.layuiUse();	
        this.goCashOut();
        this.goTeamList1();
        this.goTeamList2();
        this.goTeamList3();
        this.goProfitList();
        this.getMoneyInfo();
	},
	layuiUse:function(){
		layui.use(['layer', 'form','jquery'], function(){
            var layer = layui.layer,
                form = layui.form,
                $ = layui.$;
               
                

                let isTokenNow = public.isToken();
                if(window.location.href.indexOf('findPassword')==-1){
                    if(isTokenNow!=10000){
                        layer.msg('<p class="colorSystem font16 alignC mt15">请您先登录~</p>',{time:600},function(){
                            window.location.href="../../html/login/login.html";
                        });
                    }
                }
        });
    },
    //获取余额及收益信息
    getMoneyInfo:function(){
        $.ajax({
            type: 'post',
            url: link + '/mobile/user/profit/info',
            data: {
                token:GetCookie('token')
            },
            dataType: 'json',
            success: function (res) {
                console.log(res);
                if (res.code == 10000) {
                    let teamNum = public.numSplit1(res.entity.level1+res.entity.level2);
                    let profitNum = public.numSplit2(res.entity.totalProfit);
                    let allCashNum = public.numSplit2(res.entity.sureBalance+res.entity.notBalance);
                    let cashNum = public.numSplit2(res.entity.sureBalance);
                    let noCashNum = public.numSplit2(res.entity.notBalance);
                    $('.allCashNum').html(allCashNum);
                    $('.profitNum').html(profitNum);
                    $('.cashNum').html(cashNum);
                    $('.noCashNum').html(noCashNum);
                    $('.teamNum').html(teamNum);
                }else{
                    layer.msg(res.message);
                }
            },
            error: function (res) {

            },
        });
    },
    //跳转提现
    goCashOut:function(){
        $('body').on('click','.goCashOut',function(){
            window.location.href="../../html/cashOut/cashOut.html";
        });
    },
    //跳转团队列表-一级
    goTeamList1:function(){
        $('body').on('click','.goTeamList1',function(){
            window.location.href="../../html/teamList/teamList.html?teamType=1";
        });
    },
    //跳转团队列表-二级
    goTeamList2:function(){
        $('body').on('click','.goTeamList2',function(){
            window.location.href="../../html/teamList/teamList.html?teamType=2";
        });
    },
    //跳转团队列表-三级
    goTeamList3:function(){
        $('body').on('click','.goTeamList3',function(){
            window.location.href="../../html/teamList/teamList.html?teamType=3";
        });
    },
    //跳转收益明细
    goProfitList:function(){
        $('body').on('click','.goProditList',function(){
            window.location.href="../../html/profit/profitList.html";
        });
    },
};
profit.init();

          